<%--
  Created by IntelliJ IDEA.
  User: my
  Date: 2020/12/29
  Time: 14:30
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>登录界面</title>
    <script>

        var token = "${token}"
        if (token) { // 如果有令牌
            // localstorage 只有不手动清除一直都在
            window.localStorage.setItem("token", token);
        }
    </script>
</head>
<body>
    <h1>${message}</h1>
    <%--   login.action?uname=tom&password=123&token=lkkdfjsklda --%>
    <form action="login.action" method="post">
        <input name="phone" />
        <input name="password" />
        <input type="hidden" name="token" />
        <button>登录</button>
    </form>
<script>
    document.getElementsByName("token")[0].value = window.localStorage.getItem("token");
</script>
</body>
</html>
